<template>
 <!-- 智家 - 日看板 -->
  <div>
    <van-loading v-if="isLoading" type="spinner" color="#1989fa" />
    <div v-else class="board-zj-info">
      <div class="board-zj-item bg1">
        <div>沃家固话</div>
        <div class="sub-title">当月累计/当月目标</div>
        <div class="value" @click="openPeopleDetail('wjgh', info.WJGH_M_VALUE, info.MB_WJGH_VALUE, info.WJGH_HB)">{{ info.WJGH_M_VALUE || 0 }}/{{ info.MB_WJGH_VALUE || 0 }}<span class="unit">户</span></div>
        <div class="percent-title">
          环比上月
          <span v-if="info.WJGH_HB >= 0" class="percent up">
            {{ info.WJGH_HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_up.png" />
          </span>
          <span v-else class="percent down">
            {{ info.WJGH_HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_down.png" />
          </span>
        </div>
      </div>
      <div class="board-zj-item bg2">
        <div>沃家组网</div>
        <div class="sub-title">当月累计/当月目标</div>
        <div class="value" @click="openPeopleDetail('wjzw', info.WJZW_M_VALUE, info.MB_WJZW_VALUE, info.WJZW_HB)">{{ info.WJZW_M_VALUE || 0 }}/{{ info.MB_WJZW_VALUE || 0 }}<span class="unit">户</span></div>
        <div class="percent-title">
          环比上月
          <span v-if="info.WJZW_HB >= 0" class="percent up">
            {{ info.WJZW_HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_up.png" />
          </span>
          <span v-else class="percent down">
            {{ info.WJZW_HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_down.png" />
          </span>
        </div>
      </div>
      <div class="board-zj-item bg3">
        <div>沃家神眼</div>
        <div class="sub-title">当月累计/当月目标</div>
        <div class="value" @click="openPeopleDetail('wjsy', info.WJSY_M_VALUE, info.MB_WJSY_VALUE, info.WJSY_5G_HB)">{{ info.WJSY_M_VALUE || 0 }}/{{ info.MB_WJSY_VALUE || 0 }}<span class="unit">户</span></div>
        <div class="percent-title">
          环比上月
          <span v-if="info.WJSY_5G_HB >= 0" class="percent up">
            {{ info.WJSY_5G_HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_up.png" />
          </span>
          <span v-else class="percent down">
            {{ info.WJSY_5G_HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_down.png" />
          </span>
        </div>
      </div>
      <div class="board-zj-item bg4">
        <div>IPTV</div>
        <div class="sub-title">当月累计/当月目标</div>
        <div class="value" @click="openPeopleDetail('iptv', info.IPTV_M_VALUE, info.MB_IPTV_VALUE, info.IPTV_HB)">{{ info.IPTV_M_VALUE || 0 }}/{{ info.MB_IPTV_VALUE || 0 }}<span class="unit">户</span></div>
        <div class="percent-title">
          环比上月
          <span v-if="info.IPTV_HB >= 0" class="percent up">
            {{ info.IPTV_HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_up.png" />
          </span>
          <span v-else class="percent down">
            {{ info.IPTV_HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_down.png" />
          </span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { morningDayWise } from '@/api/publicline/board.js'

export default {
  components: { },
  data() {
    return {
      isLoading: true,
      info: {},
      queryParams: {}
    }
  },
  methods: {
    // 晨会看板-日看板-智家
    async getMorningDayWise(params) {
      this.isLoading = true
      this.queryParams = params
      const res = await morningDayWise(params)
      const { result, success } = res
      if (success) {
        this.info = result[0] || {}
        this.isLoading = false
      }
    },
    openPeopleDetail(type, value = 0, mvalue = 0, hb = 0) {
      this.$open.call(this, '/publicline/board/personal',
        {
          ...this.queryParams,
          type: type,
          flag: 'morning',
          value, mvalue, hb
        }
      )
    }
  }
}
</script>
